#pragma once
#include <iostream>
#include <cassert>
#include <vector>

namespace lw
{
	template<size_t N>
	class bitset
	{
	public:
		bitset()
		{
			_a.resize(N / 32 + 1);
		}
		~bitset()
		{}
		void set(size_t pos)
		{
			assert(pos <= N);

			int i = pos / 32;
			int j = pos % 32;
			_a[i] |= (1 << j);
		}
		void reset(size_t pos)
		{
			assert(pos <= N);

			int i = pos / 32;
			int j = pos % 32;

			_a[i] &= ~(1 << j);
		}
		bool test(size_t pos) const
		{
			assert(pos <= N);

			int i = pos / 32;
			int j = pos % 32;	

			return _a[i] & (1 << j);
		}
	private:
		std::vector<int> _a;
	};
}